import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np

x = np.arange(0, 100)
y = np.arange(0, 1000, 10)\
    + np.random.randn(100) * 100
z = np.random.randint(0, 2, 100)
h = np.random.randint(0, 4, 100)

df = pd.DataFrame(np.c_[x, y, z, h], columns=list('abcd'))
print(df[:5])

# hueX2, one figure
sns.lmplot(x='a', y='b', data=df,
           hue='c'  # 再细分
           )
plt.show()

# 2x4
sns.lmplot(x='a', y='b', data=df,
           col='d',  # 分列
           row='c'  # 分行
           )
plt.show()

# 2x2 for 4
sns.lmplot(x='a', y='b', data=df,
           col='d',  # 分列
           col_wrap=2
           )
plt.show()
